//package com.yyds.easyexceldemo;
//
//import com.alibaba.excel.EasyExcel;
//import com.alibaba.excel.read.builder.ExcelReaderBuilder;
//import com.alibaba.excel.read.builder.ExcelReaderSheetBuilder;
//import com.alibaba.excel.write.builder.ExcelWriterBuilder;
//import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder;
//
//import org.junit.Test;
//
//import java.io.InputStream;
//import java.util.Arrays;
//import java.util.Date;
//import java.util.List;
//
///**
// * @date 2022/10/12
// * @desc  easyexcel 快速上手
// */
//public class EasyExcelTest {
//
//
//    //简单读取 excel文件
//    @Test
//    public void testRead(){
//        //读取excel文件到内存中
//        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("read.xlsx");
//
//        //excel对象
//        ExcelReaderBuilder readerBuilder = EasyExcel.read(inputStream, StudentBo.class, new StudentBoReadListener());
//        //得到sheet
//        ExcelReaderSheetBuilder sheet = readerBuilder.sheet();
//        //读取sheet
//        sheet.doRead();
//    }
//
//    @Test
//    public void testWrite(){
//        //工作簿对象
//        ExcelWriterBuilder write = EasyExcel.write("./src/main/resources/write.xlsx", StudentBo.class);
//        //工作表对象
//        ExcelWriterSheetBuilder sheet = write.sheet();
//
//        //写
//        List<StudentBo> students = Arrays.asList(new StudentBo(1,"zs","男",new Date()), new StudentBo(2,"ls","女",new Date()));
//
//        sheet.doWrite(students);
//    }
//
//
//    @Test
//    public void testTemplate(){
//        String template = "./src/main/resources/template1.xlsx";
//
//        ExcelWriterBuilder write = EasyExcel.write("./src/main/resources/测试模板1.xlsx", StudentBo.class);
//
//        write.withTemplate(template);
//
//        ExcelWriterSheetBuilder sheet = write.sheet();
//
//        StudentBo studentBo = new StudentBo(1,"张三","男",new Date());
//
//        sheet.doFill(studentBo);
//    }
//
//    @Test
//    public void testTemplate2(){
//        String template = "./src/main/resources/template2.xlsx";
//
//        ExcelWriterBuilder write = EasyExcel.write("./src/main/resources/测试模板2.xlsx", StudentBo.class);
//
//        write.withTemplate(template);
//
//        ExcelWriterSheetBuilder sheet = write.sheet();
//
//        StudentBo studentBo = new StudentBo(1,"张三","男",new Date());
//
//        List<StudentBo> students = Arrays.asList(new StudentBo(1,"zs","男",new Date()), new StudentBo(2,"ls","女",new Date()));
//
//
//        sheet.doFill(students);
//    }
//
//
//}
